<?php include PATH_TPL."/tpl_header.html" ?>
<script type="text/javascript" src="/public/js/teacher/"></script>
<script type="text/javascript">
  $(function() {
        $("#personalInfo-menu").addClass('in');
        $('#uid').focus();
        $('#submit').click(function() {
          var uid      = $('#uid').val();
          var name     = $('#name').val();
          var sex      = $('#sex').val();
          var position = $('#position').val();
          var email    = $('#email').val();
          var phone    = $('#phone').val();

          if (name == '') {
              $('.errMsgName').css('display','block').html('请输入姓名!');
              $('#name').focus(function(){
                $('.errMsgName').css('display','none');
              });
              return false;
          }
          
          $.post('/index.php/student/update-personal-info/', {uid:uid,name:name,sex:sex,position:position,email:email,phone:phone}, function(data) {
              if (data.status == true) {
                location.href = '/index.php/student/success/msg/'+data.info;
              } else {
                  switch(data.data){
                      case 1:
                        $('.commonMsg').css('display','block').html(data.info);
                        return false;break;
                  }
              }
          }, 'json');
        });
    });
</script>

<div class="header">
    <h1 class="page-title">个人信息管理</h1>
</div>
        
<ul class="breadcrumb">
    <li><a>个人信息管理</a> <span class="divider">/</span></li>
    <li><a href="<?php echo SITE_ROOT?>student/show-personal-info/">我的基本信息</a> <span class="divider">/</span></li>
    <li class="active">修改个人信息</li>
</ul>

<div class="container-fluid">
    <div class="row-fluid">
        <div class="well">
          <ul class="nav nav-tabs">
            <li class="active"><a href="#home" data-toggle="tab">基本信息</a></li>
          </ul>
          <div id="myTabContent" class="tab-content">
            <div class="tab-pane active in" id="home">
              <form id="tab">
                  <div class="errMsg commonMsg"></div>
                  <div class="errMsg errMsgUid"></div>
                  <label for="uid">*学号</label>
                  <input type="text" placeholder="学号" class="input-xlarge" id="uid" value="<?php echo $student['uid']?>" readonly>

                  <div class="errMsg errMsgName"></div>
                  <label for="name">*姓名</label>
                  <input type="text" placeholder="姓名" class="input-xlarge" id="name" value="<?php echo $student['name']?>">

                  <label for="sex">性别</label>
                  <select id="sex">
                      <?php foreach($sex as $k=>$v){ ?>
                      <option value="<?php echo $k?>" <?php if($student['uid']==$k){?>selected <?php }?>><?php echo $v?></option>
                      <?php }?>
                  </select>
      
                  <label for="position">职位</label>
                  <input type="text" placeholder="职位" class="input-xlarge" id="position" value="<?php echo $student['position']?>">

                  <label for="email">电子邮箱</label>
                  <input type="text" placeholder="电子邮箱" class="input-xlarge" id="email" value="<?php echo $student['email']?>">

                  <label for="phone">电话</label>
                  <input type="text" placeholder="电话" class="input-xlarge" id="phone" value="<?php echo $student['phone']?>">
              </form>
            </div>
        </div>
        <div class="btn-toolbar">
            <button class="btn btn-primary" id="submit"><i class="icon-save"></i>保存</button>
            <div class="btn-group"></div>
        </div>
    </div>
</div>

<?php include PATH_TPL."/tpl_sidebar.html" ?>